home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 2.0 KB | 49 lines | [TEXT/GEOL] |
- Item 3396930 3-July-89 23:30
-
- From: D2019 Strategy Cons,Tech Supt,Shafer, PRT
-
- To: UK0004 Bacchus & Smith, Paul Smith
-
- cc: MACAPP.TECH$ MACAPP Tech
-
- Sub: Borland Implementation of OP
-
- As you probably know by now, your first take -- incredible as it may be -- was
- correct: you DO have to call constructors and destructors explicitly and if
- you forget to do so, the VMT doesn't get initialized. Here's from the Borland
- docs:
-
- "Each individual instance of an object must be initialized by a separate
- constructor call. It is not sufficient to initialize one instance of an object
- and then assign that instance to additional instances. The additional
- instances...will not be initialized by the assignment statements and will lock
- up the system if their virtual methods are called.
-
- (Then there's some transition material.)
-
- "What the constructor does is establish a link between the instance calling the
- constructor and the object type's VMT.
-
- "That's important to remember. There is only one VMT for each object type.
- Individual instances of an object type...contain a link to the VMT -- they do
- not contain the VMT itself."
-
- On the subject of virtual methods, you are also right. A method is only
- virtual if it is declared so with the key word VIRTUAL. Further, all virtual
- methods must be so labeled: if the method SHOW is virtual in one object class,
- and it recurs, it must be labeled in every other class. As if that weren't
- enough, here's more from their docs:
-
- "...the method heading cannot change in any way downward in an object hierarchy
- once the method is made virtual. Headers for all implementations of the same
- virtual method must be identical, right down to the number and type of
- parameters."
-
- (BTW, I obviously agree with you that a discussion here of other
- implementations of Object Pascal can be helpful and fruitful but if there's a
- lot of disagreement, I'm willing to take the discussion out of MacTech$.)
-
- Dan
-
-
-